<?php
namespace App\Service;

class SaleService extends BaseService
{
    //销售

    //列表
    public static function index()
    {
        $res = self::dbConn(self::$dbSale)
            ->skip(0)->take(5)
            ->orderBy('id', 'desc')
            ->get();
        if (!count($res)) {
            return self::toback(-2, '没有记录');
        }
        return self::toback(0, '', $res);
    }

    //导入
    public static function import($pas)
    {
        $pas['addtime'] = toDate();
        $res = self::dbConn(self::$dbSale)->insertGetId($pas);
        if (!$res) {
            return self::toback(-1, 'error');
        }
        return self::toback();
    }
}